package cn.zhbitzwz.com.testappbyid.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import cn.zhbitzwz.com.testappbyid.MyBean.WifiPicker;
import cn.zhbitzwz.com.testappbyid.R;

/**
 * Created by ZWZ on 2017/5/17.
 */

public class WifiPickerAdapter extends BaseAdapter {
    private List<WifiPicker> mList;
    private Context mContext;

    public WifiPickerAdapter(List<WifiPicker> mList, Context mContext) {
        this.mList = mList;
        this.mContext = mContext;
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater _LayoutInflater = LayoutInflater.from(mContext);
        convertView = _LayoutInflater.inflate(R.layout.spinner_item, null);

        if (convertView != null) {
            TextView _TextView1 = (TextView) convertView.findViewById(R.id.textview_icon);
            TextView _TextView2 = (TextView) convertView.findViewById(R.id.textView_valure);
            _TextView1.setText(mList.get(position).getWifiKey());
            _TextView2.setText(mList.get(position).getWifiValure());
        }
        return convertView;
    }
}
